package cn.pku.ss.fa.ui.component;

import javax.naming.InitialContext;
import org.zkoss.zul.Div;
import cn.pku.ss.fa.bean.PersonalBean;
import cn.pku.ss.fa.sessionbean.UserManagerLocal;

/**
 * @author SirX
 */
public class LoginComponent extends Div {
	
	public PersonalBean login(String name, String password) {
		try {
			InitialContext ctx = new InitialContext();
			UserManagerLocal userDao = (UserManagerLocal) ctx
					.lookup("FriendsAnywhere/UserManager/local");
			return userDao.login(name, password);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}

}
